import api from './apiHelper.js'
import helper from './helper.js'
export const weixinApi = {
	/**
	 * 获取安全认证
	 * @param {openid:'',mobile:''} data 
	 * @returns 
	 */
	token: async (data) => {
		var result = await api.post('weixin/token', data);
		if (result.code == -1) {
			return false;
		}
		uni.setStorageSync("ACCESSTOKEN", result.data);
		return true;
	},
	empower: async (data) => {
		var result = await api.post('weixin/empower', data);
		if (result.code == -1) {
			return false;
		}
		uni.setStorageSync("EMPOWER", "true");
		return true;
	}
}

export const appApi = {
	notices: async (data) => {
		var result = await api.post('appinfo/wx-notices', data);
		return result;
	}
}
export const userApi = {
	//注册用户
	register: async (data) => {
		let result = await api.post('account/register', data);
		return result;
	}
}

//CRM系统接口
export const crmApi = {
	//产品资料信息
	getproductdocumentinfo: async (data) => {
		
		let result = await api.get('productdocument/by-number?number='+data);
		return result;
	},
	//产品信息
	getproductinfo: async (data) => {
		
		let result = await api.get('product/'+data);
		return result;
	},
	//客户登录
	customerLogin: async (data) => {
		
		let result = await api.post(`customer/customer-login?documentcode=${data.documentcode}&password=${data.password}`);
		return result;
	},
	
}
//目标系统接口
export const targetApi = {
	//注册用户
	getuser: async (data) => {
		let result = await api.get('target/users-all?str='+data);
		return result;
	},
	getdeparment:async (data)=>{
		let result = await api.get('target/unit-all', data);
		return result;
	}
}

//时效分解
export const agingApi = {
	//获取待提案、分解任务
	getdeliverjob: async (data) => {
		let result = await api.post('todo-item/plan-todoitems', data);
		return result;
	},
	
	//提交提案
	submittian: async (data) => {
		let result = await api.post('planning-scheme/submit-oA', data);
		return result;
	},
	getbigtype:async ()=>{
		let result = await api.get('event-category/categorys');
		return result;
		
	},
	getsmalltype:async ()=>{
		let result = await api.get('activity-category/activity-categorys');
		return result;
		
	},
	getplanningscheme:async (data)=>{
		
		let result = await api.get('planning-scheme/'+data+'/whole-planning-scheme');
		return result;
		
	},
	getindex:async (data)=>{
		let result = await api.get('conversion-metric-item-template/itemtemplates/'+data);
		return result;
		
	},
	//分解暂存
	fjSave: async (data) => {
		let result = await api.post('planning-scheme/save-splited', data);
		return result;
	},
	fjSumit: async (data) => {
		let result = await api.post('planning-scheme/complete-splited', data);
		return result;
	},
	
	getproducts: async (data) => {
		let result = await api.post('product/products', data);
		return result;
	},
	getplanning:async (data)=>{
		let result = await api.post('/planning-scheme/inprocess-planningschemes', data);
		return result;
	},
	getreportplan:async (data)=>{
		let result = await api.post('todo-item/report-todoitems', data);
		return result;
	},
	getreportinfo:async(data)=>{
		let result = await api.get(`dept-conversion-metric/${data}/deptmetric`);
		return result;
	},
	submitreport:async (data)=>{
		let result = await api.post('dept-conversion-metric/submit-reported', data);
		return result;
	},
	getplanningdetail:async (data)=>{
		let result = await api.get(`planning-scheme/${data}/view-planning-scheme`);
		return result;
	},
	gethistoryplan:async (data)=>{
		let result = await api.post('todo-item/plannings-history', data);
		return result;
	},
	
	 
	
}